#include <iostream>
#include <vector>

using namespace std;

class Basic {
public:
    int number_a, number_b;

    int multiplyValue() { return number_a * number_b; }

    Basic(int a, int b) {
        number_a = a;
        number_b = b;
    }

    ~Basic() {
        number_a = 0;
        number_b = 0;
    }
};

class Derived : public Basic {
public:
    Derived(int a, int b) : Basic(a, b) {
        number_a = a;
        number_b = b;
    }

    int addValue() { return number_a + number_b; }
};

int main(int argc, char const *argv[]) {
    vector<Derived> vec;
    vector<Derived>::iterator iter;

    int count;
    cin >> count;

    int number_a, number_b;
    for (int i = 0; i < count; ++i) {
        cin >> number_a >> number_b;
        vec.emplace_back(Derived(number_a, number_b));
    }

    for (iter = vec.begin(); iter != vec.end(); ++iter) {
        cout << iter->multiplyValue() << endl;
        cout << iter->addValue() << endl;
    }
    return 0;
}